#include "spi.h"
#include "driver/spi_master.h"
#include "main.h"



#define PARALLEL_LINES 16


uint8_t SPI_init(void)
{
 
    esp_err_t ret;
    spi_device_handle_t spi;
    spi_bus_config_t buscfg={
        .miso_io_num=SPI_MISO,
        .mosi_io_num=SPI_MOSI,
        .sclk_io_num=SPI_SCLK,
        .quadwp_io_num=-1,
        .quadhd_io_num=-1,
        .flags=SPICOMMON_BUSFLAG_MASTER,
        .max_transfer_sz=PARALLEL_LINES*320*2+8
    };
        //Initialize the SPI bus
    ret=spi_bus_initialize(SPI_MODE, &buscfg, true);
    if(ret!=ESP_OK)
    {
        SPI_DEBUG("SPI初始化失败\r\n");
    }else
    {
        SPI_DEBUG("SPI初始化成功\r\n");

    }


 return ESP_OK;
}


















